package com.jindianjichi.subject.application.controller;


import com.alibaba.fastjson.JSON;
import com.jindianjichi.basic.entity.SubjectInfoEs;
import com.jindianjichi.basic.service.SubejectEsService;
import com.jindianjichi.infra.entity.UserInfo;
import com.jindianjichi.infra.rpc.UserRpc;
import com.jindianjichi.subject.common.entity.PageResult;
import lombok.extern.slf4j.Slf4j;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping("/subject/category")
public class TestFeignController {
    @Resource
    private UserRpc userRpc;

    @Resource
    private SubejectEsService subejectEsService;
    @RequestMapping("/testFeign")
    public void test(){
        UserInfo userInfo = userRpc.getUserInfo("op5no6xuXBu4GAVVkJO5HMrKbAp8");
        log.info("userInfo:{}", userInfo);
    }

    @RequestMapping("/querySubjectByKeyWord")
    public void querySubjectByKeyWord(){
        SubjectInfoEs subjectInfoEs = new SubjectInfoEs();
        subjectInfoEs.setKeyWords("Redis");
        PageResult<SubjectInfoEs> pageResult = subejectEsService.querySubjectList(subjectInfoEs);
        log.info("pageResult:{}", JSON.toJSONString(pageResult));

    }






}
